package com.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/exceptionTest")
@ResponseBody
public class ExceptionTest {
    @GetMapping("/test")
    public String test(String id){
        try{
//            Message msg = null;
//            msg.toString();
            createException();
            return "我是正常的";
        }catch (RuntimeException e){
            throw e;
        }
    }

    private void createException(){
        int i = 5/0;
    }
}
